<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="row">
        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('审批名称')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-name" data-rule="required" type="text" class="form-control" name="row[name]" value="{$row.name}"/>
            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-types" class="control-label col-xs-12 col-sm-2">{:__('关联对象')}:</label>
            <div class="col-xs-12 col-sm-8">
                {:build_select('row[types]', ['contract'=>'合同','receivables'=>'回款','invoice'=>'发票'],$row.types, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}

            </div>
        </div>
		<div class="col-md-4 col-xs-12 form-group">
            <label for="c-types" class="control-label col-xs-12 col-sm-2">{:__('适用组')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input   data-source="facrm/common/group" data-field="name"
                         class="form-control selectpage" name="row[group_ids]" type="text" value="{$row.group_ids}" data-multiple="true">
                <span class="text-red">留空通用</span>

            </div>
        </div>

        <div class="col-md-4 col-xs-12 form-group">
            <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea id="c-remark" class="form-control" name="row[remark]">{$row.remark}</textarea>
            </div>
        </div>
		<div class="col-md-4 col-xs-12 form-group">
            <label for="c-weigh" class="control-label col-xs-12 col-sm-2">{:__('权重')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-weigh"  type="number" class="form-control" name="row[weigh]" value="{$row.weigh}"/>
            </div>
		</div>
    </div>

    <div class="row">
        <div class="col-md-10 col-xs-12 form-group">
            <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('审批类型')}:</label>
            <div class="col-xs-12 col-sm-8">
                {:build_radios('row[config]', ['1'=>__('固定审批'), '0'=>__('授权审批')],$row.config)}
                <br/>
                <div class="table-responsive1" {if $row.config==0}style="display: none"{/if} >
                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap">
                        <thead>
                        <th>{:__('顺序')}</th>
                        <th>{:__('类型')}</th>
                        <th>{:__('选择')}</th>
                        <th>{:__('操作')}</th>
                        </thead>
                        <tbody>

                        {if $row.config==0}
                        <tr>
                            <td>1</td>
                            <td>
                                <select class="form-control selectpicker" data-rule="required" name="step[0][type]">
								    <option value="2">指定人员</option>
                                    <option value="1">上级主管</option>
									<option value="3">指定部门</option>
                                </select>
                            </td>
                            <td>
                                <input   data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"
                                         class="form-control selectpage" name="step[0][admin_ids]" type="text" value="" data-multiple="true">
                            </td>
                            <td>
                                <button type="button" class="btn btn-default delRow" >{:__('Delete')}</button>
                            </td>
                        </tr>

                        {/if}


                        {foreach name="step_list" item="vo"  index="i" }
                        <tr>
                            <td>{$i}</td>
                            <td>
                                <select class="form-control selectpicker" data-rule="required" name="step[{$i}][type]">
                                    <option value="1" {if $vo.type==1}selected="selected"{/if}>上级主管</option>
                                    <option value="2" {if $vo.type==2}selected="selected"{/if}>指定人员</option>
									<option value="3" {if $vo.type==3}selected="selected"{/if}>指定部门</option>
                                </select>
                            </td>
                            <td>
								 {if $vo.type==3}
                                <input   data-source="facrm/common/group" data-field="name"
                                         class="form-control selectpage" name="step[{$i}][admin_ids]" type="text" value="{$vo.admin_ids}" data-multiple="true">
                                {else/}
                                <input   data-source="facrm/common/selectpage/model/admin/type/all" data-field="nickname"
                                         class="form-control selectpage" name="step[{$i}][admin_ids]" type="text" value="{$vo.admin_ids}" data-multiple="true">
                                {/if}
                            </td>
                            <td>
                                <button type="button" class="btn btn-default delRow" >{:__('Delete')}</button>
                            </td>
                        </tr>
                        {/foreach}

                        </tbody>
                    </table>
                    <button type="button" class="btn btn-primary addRow" >{:__('添加审批层级')}</button>
                </div>
            </div>
        </div>
    </div>



    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('submit')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>







